package com.ljchen.formalProject.controller;

import com.ljchen.formalProject.baseController.BaseController;
import com.ljchen.formalProject.frame.vo.Result;
import com.ljchen.formalProject.model.dto.UserDto;
import com.ljchen.formalProject.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping(value = "/user")
public class UserController extends BaseController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/login")
    public Result<?> login(@RequestBody UserDto userDto) {
        return Result.ok(userService.login(userDto));
    }

    @RequestMapping(value = "/getValidateCode")
    public Result<?> getValidateCode(){
        return Result.ok();
    }

    @RequestMapping(value = "/register")
    public Result<?> register(@RequestBody UserDto userDto) {
        return Result.ok(userService.register(userDto));
    }
}
